home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / MachineExceptions.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  6KB  |  205 lines

  1. /*
  2.      File:        MachineExceptions.h
  3.  
  4.      Contains:    Processor Exception Handling Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __MACHINEEXCEPTIONS__
  19. #define __MACHINEEXCEPTIONS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. #if PRAGMA_IMPORT_SUPPORTED
  30. #pragma import on
  31. #endif
  32.  
  33. #if PRAGMA_ALIGN_SUPPORTED
  34. #pragma options align=power
  35. /* the following contents can only be used by compilers that support PowerPC struct alignment */
  36.  
  37. #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
  38. /* Some basic declarations used throughout the kernel */
  39. typedef struct OpaqueAreaID* AreaID;
  40. /* Machine Dependent types for PowerPC: */
  41. struct MachineInformationPowerPC {
  42.     UnsignedWide                     CTR;
  43.     UnsignedWide                     LR;
  44.     UnsignedWide                     PC;
  45.     unsigned long                     CR;
  46.     unsigned long                     XER;
  47.     unsigned long                     MSR;
  48.     unsigned long                     MQ;
  49.     unsigned long                     ExceptKind;
  50.     unsigned long                     DSISR;
  51.     UnsignedWide                     DAR;
  52.     UnsignedWide                     Reserved;
  53. };
  54. typedef struct MachineInformationPowerPC MachineInformationPowerPC;
  55.  
  56. struct RegisterInformationPowerPC {
  57.     UnsignedWide                     R0;
  58.     UnsignedWide                     R1;
  59.     UnsignedWide                     R2;
  60.     UnsignedWide                     R3;
  61.     UnsignedWide                     R4;
  62.     UnsignedWide                     R5;
  63.     UnsignedWide                     R6;
  64.     UnsignedWide                     R7;
  65.     UnsignedWide                     R8;
  66.     UnsignedWide                     R9;
  67.     UnsignedWide                     R10;
  68.     UnsignedWide                     R11;
  69.     UnsignedWide                     R12;
  70.     UnsignedWide                     R13;
  71.     UnsignedWide                     R14;
  72.     UnsignedWide                     R15;
  73.     UnsignedWide                     R16;
  74.     UnsignedWide                     R17;
  75.     UnsignedWide                     R18;
  76.     UnsignedWide                     R19;
  77.     UnsignedWide                     R20;
  78.     UnsignedWide                     R21;
  79.     UnsignedWide                     R22;
  80.     UnsignedWide                     R23;
  81.     UnsignedWide                     R24;
  82.     UnsignedWide                     R25;
  83.     UnsignedWide                     R26;
  84.     UnsignedWide                     R27;
  85.     UnsignedWide                     R28;
  86.     UnsignedWide                     R29;
  87.     UnsignedWide                     R30;
  88.     UnsignedWide                     R31;
  89. };
  90. typedef struct RegisterInformationPowerPC RegisterInformationPowerPC;
  91.  
  92. struct FPUInformationPowerPC {
  93.     UnsignedWide                     Registers[32];
  94.     unsigned long                     FPSCR;
  95.     unsigned long                     Reserved;
  96. };
  97. typedef struct FPUInformationPowerPC FPUInformationPowerPC;
  98.  
  99. /* Exception related declarations */
  100.  
  101. enum {
  102.     kWriteReference                = 0,
  103.     kReadReference                = 1,
  104.     kFetchReference                = 2,
  105.     writeReference                = kWriteReference,                /* Obsolete name*/
  106.     readReference                = kReadReference,                /* Obsolete name*/
  107.     fetchReference                = kFetchReference                /* Obsolete name*/
  108. };
  109.  
  110. typedef unsigned long MemoryReferenceKind;
  111. struct MemoryExceptionInformation {
  112.     AreaID                             theArea;
  113.     LogicalAddress                     theAddress;
  114.     OSStatus                         theError;
  115.     MemoryReferenceKind             theReference;
  116. };
  117. typedef struct MemoryExceptionInformation MemoryExceptionInformation;
  118.  
  119.  
  120. enum {
  121.     kUnknownException            = 0,
  122.     kIllegalInstructionException = 1,
  123.     kTrapException                = 2,
  124.     kAccessException            = 3,
  125.     kUnmappedMemoryException    = 4,
  126.     kExcludedMemoryException    = 5,
  127.     kReadOnlyMemoryException    = 6,
  128.     kUnresolvablePageFaultException = 7,
  129.     kPrivilegeViolationException = 8,
  130.     kTraceException                = 9,
  131.     kInstructionBreakpointException = 10,
  132.     kDataBreakpointException    = 11,
  133.     kIntegerException            = 12,
  134.     kFloatingPointException        = 13,
  135.     kStackOverflowException        = 14,
  136.     kTaskTerminationException    = 15,
  137.     kTaskCreationException        = 16
  138. };
  139.  
  140. #if OLDROUTINENAMES
  141.  
  142. enum {
  143.     unknownException            = kUnknownException,            /* Obsolete name*/
  144.     illegalInstructionException    = kIllegalInstructionException,    /* Obsolete name*/
  145.     trapException                = kTrapException,                /* Obsolete name*/
  146.     accessException                = kAccessException,                /* Obsolete name*/
  147.     unmappedMemoryException        = kUnmappedMemoryException,        /* Obsolete name*/
  148.     excludedMemoryException        = kExcludedMemoryException,        /* Obsolete name*/
  149.     readOnlyMemoryException        = kReadOnlyMemoryException,        /* Obsolete name*/
  150.     unresolvablePageFaultException = kUnresolvablePageFaultException, /* Obsolete name*/
  151.     privilegeViolationException    = kPrivilegeViolationException,    /* Obsolete name*/
  152.     traceException                = kTraceException,                /* Obsolete name*/
  153.     instructionBreakpointException = kInstructionBreakpointException, /* Obsolete name*/
  154.     dataBreakpointException        = kDataBreakpointException,        /* Obsolete name*/
  155.     integerException            = kIntegerException,            /* Obsolete name*/
  156.     floatingPointException        = kFloatingPointException,        /* Obsolete name*/
  157.     stackOverflowException        = kStackOverflowException,        /* Obsolete name*/
  158.     terminationException        = kTaskTerminationException,    /* Obsolete name*/
  159.     kTerminationException        = kTaskTerminationException        /* Obsolete name*/
  160. };
  161.  
  162. #endif
  163. typedef unsigned long ExceptionKind;
  164. union ExceptionInfo {
  165.     MemoryExceptionInformation *    memoryInfo;
  166. };
  167. typedef union ExceptionInfo ExceptionInfo;
  168.  
  169. struct ExceptionInformationPowerPC {
  170.     ExceptionKind                     theKind;
  171.     MachineInformationPowerPC *        machineState;
  172.     RegisterInformationPowerPC *    registerImage;
  173.     FPUInformationPowerPC *            FPUImage;
  174.     ExceptionInfo                     info;
  175. };
  176. typedef struct ExceptionInformationPowerPC ExceptionInformationPowerPC;
  177.  
  178. typedef ExceptionInformationPowerPC ExceptionInformation;
  179. typedef MachineInformationPowerPC MachineInformation;
  180. typedef RegisterInformationPowerPC RegisterInformation;
  181. typedef FPUInformationPowerPC FPUInformation;
  182. /*
  183.  Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  184.             It must be a PowerPC function pointer with NO routine descriptor. 
  185. */
  186. typedef OSStatus (*ExceptionHandler)(ExceptionInformationPowerPC *theException, void *refcon);
  187. /* Routine for installing per-process exception handlers */
  188. extern pascal ExceptionHandler InstallExceptionHandler(ExceptionHandler theHandler, void *refcon);
  189.  
  190. #endif
  191.  
  192. #pragma options align=reset
  193. #endif /* PRAGMA_ALIGN_SUPPORTED */
  194.  
  195. #if PRAGMA_IMPORT_SUPPORTED
  196. #pragma import off
  197. #endif
  198.  
  199. #ifdef __cplusplus
  200. }
  201. #endif
  202.  
  203. #endif /* __MACHINEEXCEPTIONS__ */
  204.  
  205.